//package cn.bonoon.kernel.web.handlers.loader;
//
//import java.lang.reflect.AnnotatedElement;
//
//import cn.bonoon.handler.impl.StandardAutoManager;
//import cn.bonoon.kernel.events.ReadEvent;
//import cn.bonoon.kernel.support.searcher.StandardFinder;
//import cn.bonoon.kernel.web.annotations.AutoDataLoader;
//
///**
// * <pre>
// * 自动加载数据，主要用于各类的combo控件；
// * {@link ComboAutoLoaderHandler}
// * {@link ItemAutoLoaderHandler}
// * 
// * 该父类对应处理的注解为：{@link AutoDataLoader}
// * </pre>
// * @author jackson
// *
// */
//public abstract class AbstractAutoLoaderHandler extends AbstractLoaderHandler{
////	protected StandardAutoManager autoManager;
////	protected Class<? extends Persistable> entityClass;
//	
//	protected AbstractAutoLoaderHandler(StandardAutoManager autoManager, AnnotatedElement ele, Class<?> queryClass, AutoDataLoader loader) throws Exception{
//		//super(new StandardQueryParameterBuilder(queryClass, autoManager.getSesrcher(loader.value())/*.getApplicationContext(), queryClass, loader.value()*/), autoManager);
//		super(autoManager.getSesrcher(loader.value()), autoManager, queryClass);
//		__init(autoManager, ele, loader);
//
////		ApplicationContext applicationContext = autoManager.getApplicationContext();
////		queryConverter = BytecodeFactory.query(applicationContext, queryClass, searcher.getEntityDescriptor());
//	}
//	
//	protected AbstractAutoLoaderHandler(StandardAutoManager autoManager, AnnotatedElement ele, AutoDataLoader loader) throws Exception{
//		super(autoManager.getSesrcher(loader.value()), autoManager);
//		__init(autoManager, ele, loader);
//	}
//	
//	private void __init(StandardAutoManager autoManager, AnnotatedElement ele, AutoDataLoader loader){
//		
////		this.autoManager = autoManager;
////		this.entityClass = loader.value();
////		this.searcher = new BaseSearcher(loader.value());
////		EntityDescriptor entityDescriptor = searcher.getEntityDescriptor();
//		
////		setFilter(loader.filter(), ele);
//		
////		searcher.init();
//	}
//	
////	protected StandardFinder buildFinder(ReadEvent event)throws Exception{
////		return searcher.finder(autoManager);
////	}
//	
//	protected abstract Object __parseResult(StandardFinder finder, ReadEvent event);
//
//	@Override
//	public final Object execute(ReadEvent event) throws Exception{
//		StandardFinder finder = buildFinder(event);
//		finder.combineExpression(expressionParser);
//		finder.parseExpression(event);
//		
//		filter.filter(/*searcher.initFinder(finder)*/finder, event);
//		parseQuery(finder, event);
//		return __parseResult(finder, event);
//	}
//	
//	/**
//	 * 用来解析查询条件，子类可以重写，添加更多的对查询条件的处理
//	 * @param finder
//	 * @param event
//	 */
//	protected void parseQuery(StandardFinder finder, ReadEvent event){
////		if(null != queryConverter){
////			queryConverter.query(finder.getAsmParser(), event.getSource());
////		}
//	}
//}
